package com.redpack.redpost.struts.action.admin;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.redpack.redpost.struts.form.admin.ActualizaDiasAlmacenForm;
import com.redpack.redpost.util.dao.ComentarioAdminDao;
import com.redpack.redpost.util.dao.DiasAlmacenDao;
import com.redpack.redpost.util.dao.adminDAO;

public class ActualizaDiasAlmacenVal extends Action {
	
	public ActionForward execute(
			ActionMapping mapping, 
			ActionForm form, 
			HttpServletRequest request, 
			HttpServletResponse response) throws Exception {

		/*boolean logginVal = generalUtil.isLoggedIn(request);
		if(logginVal!=true)
			return mapping.findForward("noLogin") ;*/

	    
		//ActualizaDiasAlmacenForm f = (ActualizaDiasAlmacenForm)form;
	 
	  
	    List AlmacenArribo = DiasAlmacenDao.getArriboAlmacen();
	 	    
	    if(!AlmacenArribo.isEmpty()){
	    	
	    	boolean res = false;
	    	res = DiasAlmacenDao.updateArriboAlmacen(AlmacenArribo);
	    	
	    	if(res){
	    		request.setAttribute("correcto", ""+res) ;
	    	}
	    	else{
	    		request.setAttribute("correcto", ""+res) ;
	    	}
	    }
 

	    return mapping.findForward("success");
	    
	    }

}
